Nvim Keybindigs

To exit vim/vi/nvim/ simpley use :q and enter or use ZQ, to save a file use :w and hit enter, to save and quit use shift+zz or ZZ.

so we use 'i' for inserting before the cursor, a for after the cursor and 'o' for opening up new line below the cursor. we can also use 'I', 'A', and 'O' :
To move to start of line use '0' and to move to end of line use '$'.
'I' generates insert mode at beginning of line.
'A' generates insert mode at end of line.
'O' generates insert mode above the line.
to go at top of page 'gg' and to move to end of page we use 'G'.
To go to perticular line use :40 or :65 to move to respective line numbers, we can also use 40G or 65G to move to these lines.
To search , go to normal mode and use /object_name and press 'n' to jump to next such word.
nd use 'N' to go back to such word.

To search , go to normal mode and use /object_name and press 'n' to jump to next such word.
To search backwards, use '?word_name' and now 'n' jumps to backward direction.

Most importantly we can place multiple marks throughout the text file to quickly come to that marked line.
we mark the line by 'm and then any character from a-z' and similerly we can mark another line by 'm and some other character' . ex. we mark some line by 'ma' then we work somewhere else in the code and want to quickly come to the line , we just press single quotation 'a to quickly come to 'ma' and similerly we can go to 'b which were marked
by 'mb'.
To edit/work in center part of screen, we can do so by using 'zz', don't use 'ZZ', it will save and quit the file.

To do operation with full file we use '%' in keybindings, such as seraching and replacing in full file require use like :'%s(for substitute)/character_name/replacing_word/g' and hit enter.

To search in selected portion, first select the portion by going in visual mode and then use ':<selected portion>s/word/substitution/g'

To execute the same command/keybinding/macro, just use '.' and it will repeat the command.
NOte that everything is stored in register which can be checked by ':reg'.
once you check the registers content, you will see that each register is marked with "1 or "3 or "some integer.
we can copy our content form those regiser to and fro . using '"1p' which will paste items of register "1, and '"3Y' to copy the line into register number "3.
So it means that if we delete something we have ready to copy that item too from register 1.
To indent the whole line to right use >> and to indent to left use <<.
to delete a line we use 'dd' and to delete a character we use 'x'. to delete whole page we use :%d .
to undo the editing we use 'u' one after another untill we get our desired history back.
we can also use 3 undo and 5 redos, by typing nu for 'n' number of undoes . jj
to delete the whole line with insert mode we use 'cc'.
To delete rest of line after the cursor use 'D'.
To delete a single word use 'dw'.
Note that 'dw' won't delete the whole world if we are in between the word.
To delete full word in such case when we are in middle of word, we use 'diw' i.e. delete in a word.
To delete the content after the curser use 'd$' and to delete the content of line before the cursor use 'd0'.
We can use 'ciw' to change the word when cursor in in the word(anywhere), and use 'diw' to delete the word.
To change the content of "wow this is awesome " use 'ci"'. and to delete the content in quotation marks, use 'di"'. We can also yank/copy the content of inner quotation marks. by 'yi"'. and paste it somewhere.
We can also change the contents of (even we can use opening or closing paranthesis, it does not matter) by using 'ci)'or 'ci('. and also copy the content of paranthesis by 'yi)' or 'yi('.
Similerly we can use 'dT(' or 'dT)' to find opening brackets or symbols. and 'dF*' for finding opening * character.
We can use this to yank upto starting of opening brackets 'yt(' (it will not include brackets) but 'yf('will surely copy the brackets as well. and then paste it for any purpose.

use 'dnw' to delete n words, use 5dw to delete 5 times.
we can copy 5 lines by '5yy'.

to jump to respective opening and closing arguments like () or {} or [], we use '%' keybinding.
to delete content in brackets, go to one of the brackets and use 'd%'.
To jump to perticular character use 't and that character', it will jump one character before that character, use 'f and that character()' it will jump to that character. / hi there*/, use 'f*' and 't*' to play .
To delete upto some character/bracket use 'dt)' or 'dt('. we can also use 'df)' or 'df(' but it will also delete these brackets.
We have more visual modes, visual line mode, visual block mode to select specific lines and blocks to do certain operation on them. for visual line mode we use 'V' or 'shift+v'.
To select column wise use ctrl+v to enter into visual block mode.

To make correct indentation use '=' in visual mode. go to that line and press it.
if(age<23):
cout<<"I don't like hanging out";
To auto indent the whole page/file, go to start of page by 'gg' and press '=G39G' to indent the whole file.
where 39 was relative number of above line.

To delete N words type 'dNw'.
To change the rest of line after the cursor use 'C'.
To copy full line use 'Y'.
so 'Y' is same as 'yy'.
To replace the character to to cursor and press 'r' and type the character.
To jump word after word, press 'w' for jumping in start of the words and 'e' for end of the word.
to jump after legitimate words separated by space use 'W' and 'E' for jumping at end of each word seperated by space.
To jump back to each word use 'b' and 'B' for jumping the words seperated by space.

We have 3 modes: 1. normal mode which is obtained by 'esc', insert mode by 'i', 'a', 'o', 'I', 'A', and 'O'.
and the third mode is visual mode which is used for selecting.
once the word/sentence has been selected, we can cut it, delete it with 'd', or replace it other word. To copy we use the keybinding 'y' which is called yanking, and go to place and paste it with 'p'. we can paste it 'n' number of times by just using 'np'.
We can copy the whole line with 'yy' and paste it n times by 'np'.
We can use upper case 'P' to paste it above the cursor and lower case 'p' to paste it.
so every command can be combined with a number to do it 'n' times.

we can show line numbers by
:set number command in normal mode.

also to navigate we use hjkl keys, and these keys can be used with numbers,
i.e. 5k, 10j, 3h, to move the number of lines / words/letters respectively.

Use 'G' to jump to end of page. these shortcuts are called as keybindings.

Most importantly we can use :set relativenumber and enter, to get relative line numbers with respect to current line, it helps in jumping up and down and smooth navigation.
We can activate mouse scrolling with keybinding- :set mouse=a

try :set tabstop=4
:set shiftwidth=4
:set colorscheme

these settings will be gone once the file is saved and exited.

we can have setting/configuration file that saves our settings and execute each time we open it.

for that we have .vimrc file located in place : /home/vishal/packages/nvim/

We can record macro named 'a' as 'qa', now write the macro. macro are just combination of these keybindings to make a program like of structure. once we write 'qa' everything we write comes under macro definition and to end the recording of macro we type 'esc q'.

I have execued macro on this. Let us write a macro to delete the whole line and write the "I have executed macro on this ". then we execute macro by just '@a' if we named macro by 'qa'.
To see that we have stored our macro 'a' on the register just enter ':reg' and see.
we can define such many macro named 'b' or 'c' and do the task. we can also combine these macro and make macro 'd'.